package cn.itsource.exam.controller;

import cn.itsource.exam.domain.TeacherType;
import cn.itsource.exam.query.TeacherTypeQuery;
import cn.itsource.exam.service.ITeacherTypeService;
import cn.itsource.exam.util.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/teachertype")
public class TeacherTypeController {

    @Autowired
    private ITeacherTypeService teacherTypeService;

    @PatchMapping
    public AjaxResult list(TeacherTypeQuery query){
        return teacherTypeService.list(query);
    }

    @PutMapping
    public AjaxResult save(@RequestBody TeacherType teacherType){
        return teacherTypeService.save(teacherType);
    }

    @PostMapping
    public AjaxResult update(@RequestBody TeacherType teacherType){
        return teacherTypeService.update(teacherType);
    }

    @DeleteMapping("/{id}")
    public AjaxResult delete(@PathVariable("id") Long id){
        return teacherTypeService.delete(id);
    }

    @PatchMapping("/batch")
    public AjaxResult batchDelete(@RequestBody Long[] ids){
        return teacherTypeService.batchDelete(ids);
    }



}
